<template>
  <div class="app-Inquiry" style="margin: 0 !important;">
    <div class="top-container">
      <el-form
        :inline="true"
        :model="formInline"
        ref="formInline"
        class="demo-form-inline"
        style="display: block !important;"
      >
        <el-form-item label="后台单号" style="margin-bottom: 15px!important;">
          <el-input
            v-model.trim="formInline.xmbzNo"
            clearable
            size="medium"
            placeholder="后台单号"
            style="width: 163px;"
          ></el-input>
        </el-form-item>
        <el-form-item label="城市" style="margin-bottom: 15px!important;">
          <el-select
            ref="deptRef"
            v-model="deptName"
            placeholder="城市"
            size="medium"
            style="width: 100px;"
            @change="handleCity"
            @keydown.native="selectBlur($event)"
          >
            <el-option
              v-for="(house,citykey) in cityselect"
              :key="citykey"
              :label="house.deptName"
              :value="{value:house.id,label:house.deptName}"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="状态" style="margin-right: 0;margin-bottom: 15px!important;">
          <el-select
            ref="statusRef"
            v-model="formInline.state"
            clearable
            size="medium"
            placeholder="状态"
            style="width: 130px"
            @keydown.native="selectBlur($event)"
          >
            <el-option
              v-for="item in statusList"
              :key="item.status"
              :label="item.statusName"
              :value="item.status"
            />
          </el-select>
        </el-form-item>

        <el-form-item label="分仓" style="margin-bottom: 15px!important;">
          <el-select
            ref="barnchWarehouseRef"
            v-model="formInline.warehouseId"
            @keydown.native="selectBlur($event)"
            clearable
            filterable
            size="medium"
            placeholder="分仓"
            style="width: 155px"
          >
            <el-option
              v-for="(item,index) in barnchWarehouselist"
              :key="index"
              :label="item.name"
              :value="item.id"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item sytle="dispaly:flex">
          <el-date-picker
            v-model="timeValue"
            type="datetimerange"
            range-separator="至"
            start-placeholder="开始时间"
            end-placeholder="结束时间"
            :picker-options="pickerOptions"
            :default-time="['00:00:00', '23:59:59']"
            value-format="yyyy-MM-dd HH:mm"
            format="yyyy-MM-dd HH:mm"
            size="medium"
            align="right"
          ></el-date-picker>
        </el-form-item>
        <el-form-item style="margin-bottom: 15px!important;">
          <el-button
            type="primary"
            @click="onSubmit('formInline')"
            size="medium"
            plain
            icon="el-icon-search"
            style="margin-left: 30px;"
          >查询
          </el-button>
        </el-form-item>
      </el-form>
    </div>
    <div class="table-container">
      <el-table
        class="table-width"
        :data="querylist"
        header-row-class-name="table-top"
        :row-class-name="tableRowClassName"
        style="width: 100%"
      >
        <el-table-column type="expand">
          <template slot-scope="props">
            <el-form label-position="left" inline class="demo-table-expand">
              <el-form-item label="京东物流id">
                <span>{{ props.row.logistics_id}}</span>
              </el-form-item>
              <el-form-item label="距离">
                <span>{{ props.row.distance }}Km</span>
              </el-form-item>
              <el-form-item label="接单时间">
                <span>{{ props.row.receiving_time }}</span>
              </el-form-item>
              <el-form-item label="到店时间">
                <span>{{ props.row.arrive_time }}</span>
              </el-form-item>
              <el-form-item label="取件时间">
                <span>{{ props.row.pickup_time }}</span>
              </el-form-item>
              <el-form-item label="签收时间">
                <span>{{ props.row.sign_time }}</span>
              </el-form-item>
              <el-form-item label="取消时间">
                <span>{{ props.row.cancel_time }}</span>
              </el-form-item>
              <el-form-item label="创始人" >
                <span>{{ props.row.create_user }}</span>
              </el-form-item>
              <el-form-item label="取消人" >
                <span>{{ props.row.cancel_user }}</span>
              </el-form-item>
              <el-form-item label="当前节点" >
                <span>{{ props.row.trace_node }}</span>
              </el-form-item>
              <el-form-item label="当前节点备注" label-width="100px">
                <span>{{ props.row.trace_mark }}</span>
              </el-form-item>
              <el-form-item label="当前节点时间" label-width="100px">
                <span>{{ props.row.trace_time }}</span>
              </el-form-item>
              <el-form-item style="width: 100%" label="收货地址">
                <span>{{ props.row.receiver_address }}</span>
              </el-form-item>
            </el-form>
          </template>
        </el-table-column>

        <el-table-column prop="status" label="订单状态" align="center" min-width="60">
          <template slot-scope="scope">
            <span style="margin-left: 10px">{{ getOrderStatus(scope.row.status) }}</span>
          </template>
        </el-table-column>
        <el-table-column prop="xmbz_no" label="单号" align="center"></el-table-column>
        <el-table-column label="城市名称" prop="dept_name" align="center"></el-table-column>
        <!-- <el-table-column
          label="配送时间"
          align="center"
          prop="deliveryStartTime"
          min-width="85"
        >
          <template slot-scope="scope">
            <span v-if="scope.row.delivery_start_time == ''" style="margin-left: 10px">立即配送</span>
            <span
              v-if="scope.row.delivery_start_time !== ''"
              style="display: flex;flex-direction: column;"
            >
              <span>{{ scope.row.delivery_start_time.slice(0,10) }}</span>
              <span>{{ scope.row.delivery_start_time.slice(11,16) }}~{{ scope.row.delivery_end_time.slice(11,16) }}</span>
            </span>
          </template>
        </el-table-column>
        <el-table-column
          label="发布时间"
          align="center"
          prop="create_time"
          min-width="77"
        >
        </el-table-column> -->
        <el-table-column prop="branch_warehouse" label="仓库名称" align="center"></el-table-column>
        <el-table-column prop="waybill_code" label="运单号" align="center"></el-table-column>
        <el-table-column prop="driver_name" label="骑手" align="center"></el-table-column>
        <el-table-column prop="driver_mobile" label="骑士电话"></el-table-column>
        <el-table-column prop="state" label="京东物流状态" align="center">
          <template slot-scope='scope'>
            <span>{{changeJDstatus(scope.row.state)}}</span>
          </template>
        </el-table-column>
        <el-table-column prop="delivery_start_time" label="配送开始时间" align="center" width="150"></el-table-column>
        <el-table-column prop="delivery_end_time" label="配送结束时间" align="center" width="150"></el-table-column>
        <el-table-column prop="create_time" label="发布时间" align="center" width="150"></el-table-column>
        <el-table-column fixed="right" label="操作" align="center" width="100">
          <template slot-scope="scope">
            <el-button v-show="!(scope.row.state==10||scope.row.state==-1)" type="danger" size="mini" @click="cancelOrder(scope.row)">取消订单</el-button>
            <el-button type="success" size="mini" @click="handshowDayItem(scope.row)">查看日志</el-button>
            <el-button type="warning" size="mini" v-show=" !(scope.row.state == 10 || scope.row.state==-1)" @click="handbackgoods(scope.row)">退回货物</el-button>
          </template>
        </el-table-column>
      </el-table>
      <pagination
        v-show="total>0"
        :total="total"
        :page.sync="formInline.page"
        :limit.sync="formInline.size"
        @pagination="getList"
      />
    </div>

      <!-- 日志进度 -->
      <el-dialog
            title="日志进度"
            :visible.sync="islogProgress"
            width="50%" >
        <el-radio-group v-model="reverse">
          <el-radio :label="true">倒序</el-radio>
          <el-radio :label="false">正序</el-radio>
        </el-radio-group>
            <!-- 时间线 -->
            <el-timeline :reverse="reverse">
                <el-timeline-item
                v-for="(item, index) in this.logProgress"
                :key="index"
                :timestamp="item.createTime">
                <p>{{item.operator}}</p>
                <h3>【{{item.traceNode}}】{{item.traceMark}}</h3>
                </el-timeline-item>
            </el-timeline>
      </el-dialog>

      <!-- 取消订单 -->
       <el-dialog
            title="取消订单"
            :visible.sync="iscancellationOrder"
            width="50%" >
        <div style="display: flex; align-items: center; margin-bottom: 20px;">
            <span style="margin-right: 20px">请选择取消订单选项:</span>
            <el-select v-model="iscancellationSelect" slot="prepend" placeholder="请选择取消订单选项">
              <el-option label="客户主动取消" value="1000"></el-option>
              <el-option label="备货、包装、货品质量取消" value="1001"></el-option>
              <el-option label="配送态度问题取消" value="1002"></el-option>
              <el-option label="骑手配送不及时" value="1003"></el-option>
              <el-option label="骑手取货不及时" value="1004"></el-option>
              <el-option label="长时间无人接单" value="1005"></el-option>
              <el-option label="其他原因" value="1006"></el-option>
            </el-select>
        </div>
        <div style="display: flex; align-items: center;">
          <span style="width:80px">取消备注:</span>
          <el-input
            type="textarea"
            :rows="2"
            placeholder="请输入内容(可以不输入备注)"
            v-model="textarea">
        </el-input>
        </div>
        <span slot="footer" class="dialog-footer">
          <el-button @click="iscancellationOrder = false" style="margin-right: 50px">取 消</el-button>
          <el-button type="primary" @click="goCancelorder">确 定</el-button>
        </span>
      </el-dialog>
  </div>
</template>

<script>
  import {
    statusList,
    getWarehouseListByCityId
  } from "@/api/pending";
  import {
    citySelect, // 城市
  } from "@/api/createOrder";
  import {
    uuStatusList,
    getUUOrders,
    logisticsList,   // 列表 搜索
    showDaytitle,  // 日志授权
    cancellationOrder,  //取消发布订单
    JDretreat   // 确认拒收接口 
  } from "@/api/uu-apis";
  import Pagination from "@/components/Pagination";
  import {cancelUUOrder} from "../../api/uu-apis"; // 分页
  export default {
    components: {
      Pagination
    },
    data() {
      return {
        ischangedata: {}, //选中的数据
        textarea: '', //备注内容
        iscancellationSelect: '', //取消订单原因
        iscancellationOrder: false,  //取消订单 
        islogProgress: false, //显示日志
        logProgress: [], // 日志列表
        reverse: false, // 日志顺序
        barnchWarehouselist: [],
        total: 0,
        deptId: "",
        deptName: "",
        formInline: {
          deptId: 0, // 城市id
          xmbzNo: "", // 后台单号
          status: "",
          deliveryStartTime: "", // 配送开始时间
          deliveryEndTime: "", // 配送结束时间
          warehouseId: '',
          page: 1,
          size: 10
        },
        querylist: [],
        Loading: true,
        statusList: [], // 状态
        orderStatusList: [], // 状态
        pickerOptions: {
          onPick: obj => {
            this.pickerMinDate = new Date(obj.minDate).getTime();
          },
          disabledDate: time => {
            if (this.pickerMinDate) {
              const day1 = 31 * 24 * 3600 * 1000;
              let maxTime = this.pickerMinDate + day1;
              let minTime = this.pickerMinDate - day1;
              return time.getTime() > maxTime || time.getTime() < minTime;
            }
          }
        },
        cityselect: "", // 城市获取列表
        timeValue: [], // 查询时间值
        timeValueFlag: false, // 查询时间是否大于31天标记

      };
    },
    created() {
      window.addEventListener("keydown", this.keyupEnter);
    },
    watch: {},
    mounted() {
      citySelect(this.cityLi).then(res => {
        this.roleName = JSON.parse(window.localStorage.getItem('saber-userInfo')).content.authority;
        if (this.roleName.indexOf('administrator') > -1 || this.roleName.indexOf('CSD') > -1 ||
          this.roleName.indexOf('admin') > -1 || this.roleName.indexOf('PHONE') > -1 ||
          this.roleName.indexOf('ORDER') > -1 || this.roleName.indexOf('AFTER') > -1 ||
          this.roleName.indexOf('生产总监') > -1 || this.roleName.indexOf('运力部门') > -1 ||
          this.roleName.indexOf('运力总监') > -1 || this.roleName.indexOf('调度部经理') > -1 ||
          this.roleName.indexOf('调度') > -1 || this.roleName.indexOf('商品部门') > -1 ||
          this.roleName.indexOf('营销部运营') > -1 || this.roleName.indexOf('营销部经理') > -1 ||
          this.roleName.indexOf('客服经理') > -1 || this.roleName.indexOf('客服权限管理') > -1 ||
          this.roleName.indexOf('客服主管') > -1 || this.roleName.indexOf('在线组') > -1 ||
          this.roleName.indexOf('运营中心') > -1 || this.roleName.indexOf('品牌事业部') > -1 ||
          this.roleName.indexOf('设计组') > -1 || this.roleName.indexOf('内容事业部') > -1 ||
          this.roleName.indexOf('内容组') > -1 || this.roleName.indexOf('三方事业部') > -1 ||
          this.roleName.indexOf('运营主管') > -1 || this.roleName.indexOf('美团团购') > -1 ||
          this.roleName.indexOf('运营专员') > -1 || this.roleName.indexOf('用户运营事业部') > -1 || this.roleName.indexOf('用户运营组') > -1 ||
          this.roleName.indexOf('微商城事业部') > -1 || this.roleName.indexOf('高级运营经理') > -1 ||
          this.roleName.indexOf('美团外卖') > -1 || this.roleName.indexOf('商品经理') > -1 ||
          this.roleName.indexOf('视频剪辑') > -1 || this.roleName.indexOf('营销总监') > -1 ||
          this.roleName.indexOf('营销部门权限管理') > -1 || this.roleName.indexOf('运力权限管理') > -1 ||
          this.roleName.indexOf('微商城组长') > -1 || this.roleName.indexOf('总部客服') > -1 || this.roleName.indexOf('客服数据员') > -1 ||
          this.roleName.indexOf('客服组长') > -1 || this.roleName.indexOf('财务') > -1 ||
          this.roleName.indexOf('好评返现审批') > -1 || this.roleName.indexOf('成本会计') > -1 ||
          this.roleName.indexOf('后勤中心') > -1 || this.roleName.indexOf('微商城组员') > -1 ||
          this.roleName.indexOf('人事') > -1 || this.roleName.indexOf('营销总监') > -1
        ) res.data.data.unshift({
          id: 0,
          deptName: "全国"
        });
        this.deptName = res.data.data[0].deptName;
        this.formInline.deptId = res.data.data[0].id;
        this.cityselect = res.data.data;
      });
      this.getWarehouseList();
      // 状态列表接口
      this.statusList = uuStatusList();
      //订单状态
      // 状态列表接口
      statusList().then(res => {
        this.orderStatusList = res.data.data;
      });
      this.getDeliveryTime();
      this.getList();

    },
    methods: {
      handbackgoods(row){
        this.$confirm("确认拒收或退回货物?", {
          confirmButtonText: "确定",
          cancelButtonText: "关闭",
          type: "warning"
        }).then(()=>{
          let data = {
            xmbzNo: row.xmbz_no,
            userName: this.$store.state.user.userInfo.userName
          }
          JDretreat(data).then(res => {
            if(res.data.code == 200){
              this.$message({
                message: '操作成功',
                type: 'success'
              })
              this.getList()
            }
          })
        })
      },
      goCancelorder(){
        if(!this.iscancellationSelect){
          this.$message({
            message: '请选择取消订单先选项',
            type: 'warning'
          });
          return
        }
        let data = {
          xmbzNo:this.ischangedata.xmbz_no,
          cancelReasonId: this.iscancellationSelect,
          userName: this.$store.state.user.userInfo.userName,
          reason: this.textarea
        }
        cancellationOrder(data).then(res=>{
          if(res.data.code == 200 ){
            this.$notify({
              title: '成功',
              message: '取消订单成功',
              type: 'success'
            });
            this. iscancellationOrder = false;
            this. textarea = ''
            this. iscancellationSelect = '',
            this.getList()
          }else{
            this.$notify.error({
              title: '错误',
              message: '取消订单失败'
            });
          }
        })
        // console.log(this.ischangedata, this.textarea, this.iscancellationSelect)
      },
      handshowDayItem(item){
        showDaytitle({logisticsId:item.logistics_id}).then(res=>{
          this.islogProgress = true
          this.logProgress = res.data.data.rows 
        })
      },
      changeJDstatus(id){
        switch(id){
          case 1: 
           return '下单成功'
          case 3:
            return '抢单成功'
          case 4: 
            return '取货失败'
          case 5: 
            return '派单失败'
          case 6: 
            return '超时未抢单'
          case 7: 
            return '配送员收货'
          case 8: 
            return '骑士到店'
          case 9:
            return '拒收'
          case 10:
            return '妥投'
          case -1:
            return '订单取消'
          default:
            return '无'
        }
      },
      getUuStatus(id){
        for (let i = 0; i < this.statusList.length; i++) {
          if(this.statusList[i].status == id){
            return this.statusList[i].statusName;
          }
        }
      },
      getOrderStatus(id){
        for (let i = 0; i < this.orderStatusList.length; i++) {
          if(this.orderStatusList[i].status == id){
            return this.orderStatusList[i].statusName;
          }
        }
      },
      // 获取今天的时间
      getCurrentTime() {
        let nowYear = new Date().getFullYear();
        let nowMonth =
          new Date().getMonth() + 1 < 10
            ? "0" + (new Date().getMonth() + 1)
            : new Date().getMonth() + 1;
        let nowDate =
          new Date().getDate() < 10
            ? "0" + new Date().getDate()
            : new Date().getDate();
        // let currentTime = new Date();
        // let year = currentTime.getFullYear();
        // let month = currentTime.getMonth() + 1 < 10 ? '0' + (currentTime.getMonth() + 1) : currentTime.getMonth() + 1;
        // let day = currentTime.getDate() < 10 ? '0' + currentTime.getDate() : currentTime.getDate();
        this.formInline.StartTime =
          nowYear + "-" + nowMonth + "-" + nowDate + " 00:00:00";
        this.formInline.EndTime =
          nowYear + "-" + nowMonth + "-" + nowDate + " 23:59:59";
        this.formInline.deliveryStartTime = this.formInline.StartTime;
        this.formInline.deliveryEndTime = this.formInline.EndTime;
        this.formInline.orderTimeStart = "";
        this.formInline.orderTimeEnd = "";
        this.getList();
        // console.log('this.formInline.deliveryStartTime',this.formInline.deliveryStartTime)
      },
      // 获取城市
      handleCity(data) {
        // console.log(data,'data')
        if (data) {
          this.deptName = data.label;
          this.formInline.deptId = data.value;
        } else {
          this.formInline.deptId = JSON.parse(
            window.localStorage.getItem("saber-areaId")
          ).content;
          this.deptName = JSON.parse(
            window.localStorage.getItem("saber-areaname")
          ).content;
        }
        this.getWarehouseList();
      },
      getWarehouseList() {
        getWarehouseListByCityId({cityId: this.formInline.deptId}).then(res => {
          this.barnchWarehouselist = res.data.data;
        });
      },
      onSubmit() {
        this.formInline.page = 1;
        if (this.formInline.select === "配送时间") {
          this.formInline.distinguishingFields = "1";
        } else {
          this.formInline.distinguishingFields = "2";
        }
        this.getList();
      },
      dealData(authority) {
        const newArr = [];
        authority.forEach(item => {
          newArr.push({
            checked: true,
            value: item
          });
        });
        return newArr;
      },
      // 查询列表
      getList() {
        this.queryTime();
        if (this.formInline.xmbzNo !== '') {
          this.formInline.deliveryStartTime = "";
          this.formInline.deliveryEndTime = "";
        } else if (this.formInline.deliveryStartTime == "" && this.formInline.deliveryEndTime == "") {
          this.$message.warning('请输入搜索时间，且跨度不能超过31天');
          return false;
        }
        if (!this.timeValueFlag) {
          this.Loading = true;
          logisticsList(this.formInline).then(res=>{
            this.total = res.data.data.total
            this.querylist = res.data.data.rows
            setTimeout(() => {
                this.Loading = false;
              }, 0.5 * 1000);
          })
        }
      },
      // 紧急单颜色变化
      tableRowClassName({row}) {
        // console.log(row.getHour,row.id,'row')
        if (row.getHour === false) {
          // console.log('false')
          return "warning-row";
        }
        return "";
      },
      // 计算时间差
      getHour(endTime) {
        let nowYear = new Date().getFullYear();
        let nowMonth =
          new Date().getMonth() + 1 < 10
            ? "0" + (new Date().getMonth() + 1)
            : new Date().getMonth() + 1;
        let nowDate =
          new Date().getDate() < 10
            ? "0" + new Date().getDate()
            : new Date().getDate();
        let nowHours =
          new Date().getHours() < 10
            ? "0" + new Date().getHours()
            : new Date().getHours();
        let nowMinutes =
          new Date().getMinutes() < 10
            ? "0" + new Date().getMinutes()
            : new Date().getMinutes();
        // console.log(e.currentTarget.dataset.time,nowYear + '-' + nowMonth + '-' + nowDate + ' ' + nowHours + ':' + nowMinutes)
        let nowTime =
          nowYear +
          "-" +
          nowMonth +
          "-" +
          nowDate +
          " " +
          nowHours +
          ":" +
          nowMinutes;
        let s1 = new Date(endTime.replace(/-/g, "/"));
        // console.log('s1',s1)
        let s2 = new Date(nowTime.replace(/-/g, "/"));
        let ms = Math.abs(s1.getTime() - s2.getTime());
        let getHour = ms / 1000 / 60 / 60;
        // console.log('getHour',getHour)
        return getHour;
      },

      // 设置默认查询日期
      getDeliveryTime() {
        //前一天设定的日期时间
        let d = new Date();
        let year1, month1, day1;
        [year1, month1, day1] = [d.getFullYear(), d.getMonth(), d.getDate()];
        let date1 = new Date(year1, month1, day1, 0);
        let nowMonth1 =
          new Date().getMonth() + 1 < 10
            ? "0" + (new Date().getMonth() + 1)
            : new Date().getMonth() + 1;
        let nowDate1 =
          new Date().getDate() < 10
            ? "0" + new Date().getDate()
            : new Date().getDate();
        let deliveryStartTime =
          date1.getFullYear() +
          "-" +
          nowMonth1 +
          "-" +
          nowDate1 +
          " " +
          "00:00";
        this.timeValue.unshift(deliveryStartTime);
        this.formInline.deliveryStartTime = deliveryStartTime;
        let date2 = new Date(year1, month1, day1, 23, 59, 59);
        let deliveryEndTime =
          date2.getFullYear() +
          "-" +
          nowMonth1 +
          "-" +
          nowDate1 +
          " " +
          "23:59";
        this.timeValue.push(deliveryEndTime);
        this.formInline.deliveryEndTime = deliveryEndTime;
      },
      // 查询配送时间
      queryTime() {
        if (this.timeValue && this.timeValue.length) {
          this.formInline.deliveryStartTime = this.timeValue[0] + ":00";
          this.formInline.deliveryEndTime = this.timeValue[1] + ":59";
        } else {
          this.formInline.deliveryStartTime = "";
          this.formInline.deliveryEndTime = "";
        }
        this.isgreaterThan(
          this.formInline.deliveryStartTime,
          this.formInline.deliveryEndTime
        );
      },
      // 判断是否大于31天
      isgreaterThan(time1, time2) {
        var data1 = Date.parse(time1.replace(/-/g, "/"));
        var data2 = Date.parse(time2.replace(/-/g, "/"));
        var datadiff = data2 - data1;
        var time = 31 * 24 * 60 * 60 * 1000;
        if (time1.length > 0 && time2.length > 0) {
          if (datadiff < 0 || datadiff > time) {
            this.$message.warning("时间间隔不可超过31天");
            return (this.timeValueFlag = true);
          } else {
            return (this.timeValueFlag = false);
          }
        }
      },


      // 静止输入空格
      keydown(event) {
        if (event.keyCode == 32) {
          event.returnValue = false;
        }
        if (event.keyCode == 13) {
          this.$refs["channelTypeRef"].blur();
          this.$refs["channelRef"].blur();
          event.returnValue = false;
        }
      },
      // 回车事件
      keyupEnter() {
        // const that = this;
        if (window.event.keyCode == 13) {
          this.onSubmit();
        }
      },
      selectBlur(e) {
        if (e.keyCode == 13) {
          this.$refs["deptRef"].blur();
          this.$refs["statusRef"].blur();
          this.$refs["selectRef"].blur();
          this.$refs["barnchWarehouseRef"].blur();
          e.returnValue = false;
        }
      },
      temNselectBlur(e) {
        if (e.keyCode == 32) {
          e.returnValue = false;
        }
      },
      //取消订单
      cancelOrder(order){
        this.iscancellationOrder = true 
        this.ischangedata = order
        // this.$confirm("确定取消京东物流订单?", {
        //   confirmButtonText: "确定",
        //   cancelButtonText: "关闭",
        //   type: "warning"
        // }).then(() => {
        //   cancelUUOrder({xmbzNo: order.xmbz_no, reason: '订单系统取消'}).then(response => {
        //     if(response.data.return_code === 'ok'){
        //       this.$notify({
        //         title: '提示',
        //         message: '订单取消成功',
        //         type: 'success'
        //       });
        //       this.getList();
        //     } else {
        //       this.$notify({
        //         title: '提示',
        //         message: '订单取消失败：' + response.data.return_msg,
        //         type: 'error'
        //       })
        //     }
        //   })
        // });
      }
    },
    destroyed() {
      window.removeEventListener("keydown", this.keyupEnter);
    },
    activated() {
      this.roleName = JSON.parse(window.localStorage.getItem('saber-userInfo')).content.authority;
      window.addEventListener("keydown", this.keyupEnter);
    },
    //如果页面有keep-alive缓存功能，这个函数会触发
    deactivated() {
      window.removeEventListener("keydown", this.keyupEnter);
    }
  };
</script>

<style lang="scss" scoped>
  .red {
    color: #ff0000;
  }

  .app-Inquiry {
    padding-right: 5px;

    .top-container {
      padding: 20px 10px 10px 20px;

      .el-form {
        .el-form-item {
          .line {
            margin: 0 3px;
            color: #8c919c;
          }
        }
      }

      .demo-form-inline {
        display: inline-block;
      }

      .el-form-item {
        margin-bottom: 20px !important;
      }
    }

    .table-container {
      padding-left: 20px;

      .table-top {
        font-size: 13px;

        th {
          padding: 5px 2px;

          .cell {
            padding: 0;
          }
        }
      }

      .el-table {
        .el-col-primary {
          margin: 0;
          padding: 2px 2px;
          font-size: 12px;
          font-weight: 400;
          border-radius: 4px;
          width: 78%;

          &.mainbutton {
            background: #ecf5ff;
            color: #409eff;
            border: 1px solid #b3d8ff;
          }

          &.dangerbutton {
            background: #fef0f0;
            color: #f56c6c;
            border: 1px solid #fbc4c4;
          }

          &.infobutton {
            background: #f4f4f5;
            color: #909399;
            border: 1px solid #d3d4d6;
          }

          &.warnbutton {
            background: #fdf6ec;
            color: #e6a23c;
            border: 1px solid #f5dab1;
          }
        }
      }

      .el-table__row {
        td {
          padding: 15px 2px;
          font-size: 13px;
          font-weight: 600;

          .cell {
            padding: 0;

            span {
              margin-left: 0;
            }
          }
        }
      }

      .active {
        color: #409eff;
        font-size: 13px;
        font-weight: 600;
      }

      .buttoncolor {
        color: #000;
        font-size: 13px;
        font-weight: 600;
      }

      .warning-row {
        background: oldlace;
        color: #e6a23c;
      }

    }
  }
  .el-button+{
    .el-button{
      margin: 0
    }
  }
  .el-date-range-picker .el-picker-panel__footer .el-button--text span {
    display: none;
  }

  .table-width {
    .el-table__fixed {
      .el-table__fixed-body-wrapper {
        .el-table__body {
          .el-table__row {
            td {
              .cell {
                span {
                  margin-left: 0 !important;
                }
              }
            }
          }
        }
      }
    }
  }

  .demo-table-expand {
    font-size: 0;
  }
  .demo-table-expand label {
    width: 90px;
    color: #99a9bf;
  }
  .demo-table-expand .el-form-item {
    margin-right: 0;
    margin-bottom: 0;
    width: 33%;
  }
</style>
